﻿// <copyright file="InformSoftwareVersion.cs" company="Hallvard Korsgaard">
//  Microsoft Public License (Ms-PL). See license details here: http://enoceannet.codeplex.com/license
// </copyright>
// <author>Hallvard Korsgaard</author> 

namespace EnOcean.Message
{
  using System;

  /// <summary>
  /// Informs the user about the current software version of the TCM 120.
  /// </summary>
  [Serializable]
  public class InformSoftwareVersion : MessageTelegram
  {
    /// <summary>
    /// Gets the version at position 1.
    /// </summary>
    public byte VersionPosition1
    {
      get;
      internal set;
    }

    /// <summary>
    /// Gets the version at position 2.
    /// </summary>
    public byte VersionPosition2
    {
      get;
      internal set;
    }

    /// <summary>
    /// Gets the version at position 3.
    /// </summary>
    public byte VersionPosition3
    {
      get;
      internal set;
    }

    /// <summary>
    /// Gets the version at position 4.
    /// </summary>
    public byte VersionPosition4
    {
      get;
      internal set;
    }

    /// <summary>
    /// Creates the byte format of the message.
    /// </summary>
    /// <param name="message">A byte array of length 14 to hold the message contents.</param>
    protected internal override void CreateMessage(byte[] message)
    {
      base.CreateMessage(message);
      message[3] = (byte)MessageType.InformSoftwareVersion;
      message[4] = this.VersionPosition1;
      message[5] = this.VersionPosition2;
      message[6] = this.VersionPosition3;
      message[7] = this.VersionPosition4;
    }
  }
}
